<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


        <button onclick="saveUser()">添加用户</button>

        <script src="https://unpkg.com/axios/dist/axios.js"></script>

        <script>

            function saveUser(){

                //模拟页面上的 用户信息
                let user = {
                    username:'张三',
                    password:'123456',
                    age:18
                }

                //将表单数据 发送到 后端   axios  post 触发两次 请求   1 预检  2 真实的请求
                // axios.get('http://localhost:8080/web/p5?username=zhangsan&password=123456')
                axios.post('http://localhost:8080/web/p6',user)
            //

            }


        </script>

</body>
</html>